gllogicop
- Man Page
glLogicOp(3G) OpenGL Reference glLogicOp(3G)
NAME
glLogicOp - specify a logical pixel operation for rendering
C SPECIFICATION
void glLogicOp( GLenum opcode )
PARAMETERS
opcode Specifies a symbolic constant that selects a logical operation.
The following symbols are accepted: GL_CLEAR, GL_SET, GL_COPY,
GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND, GL_OR,
GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED,
GL_OR_REVERSE, and GL_OR_INVERTED. The default is GL_COPY.
DESCRIPTION
glLogicOp specifies a logical operation that, when enabled, combines the
incoming color or color index and the color or color index from the frame
buffer. Logicops are used differently in color index mode and RGBA mode.
In color index mode the logical operation is enabled or disabled with
glEnable and glDisable using the symbolic constant GL_LOGIC_OP.
In RGBA mode glLogicOp is used to specify a blending operation. The
specified logicop is used if blending is enabled and the blend equation
is set to GL_LOGIC_OP. (see glBlendEquationExt). In RGBA mode each
component of an incoming fragment's color is combined with the
corresponding component of the color taken from the color buffer.
opcode is a symbolic constant chosen from the list below. In the
explanation of the logical operations, s represents each of the 4
incoming color components, or it represents the color index. d represents
the corresponding value in the frame buffer. Standard C-language
operators are used. As these bitwise operators suggest, the logical
operation is applied independently to each bit pair of the source and
destination indices or color components.
Page 1
glLogicOp(3G) OpenGL Reference glLogicOp(3G)
_____________________________________
|_________________|_________________|
| GL_CLEAR | 0 |
| GL_SET | 1 |
| GL_COPY | s |
|GL_COPY_INVERTED | !s |
| GL_NOOP | d |
| GL_INVERT | ~d |
| GL_AND | s & d |
| GL_NAND | ~(s & d) |
| GL_OR | s | d |
| GL_NOR | ~(s | d) |
| GL_XOR | s ^ d |
| GL_EQUIV | ~(s ^ d) |
| GL_AND_REVERSE | s & ~d |
|GL_AND_INVERTED | ~s & d |
| GL_OR_REVERSE | s | ~d |
| GL_OR_INVERTED | ~s | d |
|_________________|_________________|
NOTES
When more than one color buffer is enabled for drawing, logical
operations are done separately for each enabled buffer, using for the
destination index the contents of that buffer (see glDrawBuffer).
In RGB mode glLogicOp is part of the EXT_blend_logic_op extension, not
part of the core GL command set. If GL_EXT_blend_logic_op is included in
the string returned by glGetString, when called with argument
GL_EXTENSIONS, extension EXT_blend_logic_op is supported by the
connection.
ERRORS
GL_INVALID_ENUM is generated if opcode is not an accepted value.
GL_INVALID_OPERATION is generated if glLogicOp is executed between the
execution of glBegin and the corresponding execution of glEnd.
ASSOCIATED GETS
glGet with argument GL_LOGIC_OP_MODE
glIsEnabled with argument GL_LOGIC_OP
SEE ALSO
glAlphaFunc, glBlendFunc, glBlendEquationEXT, glDrawBuffer, glEnable,
glStencilOp
Page 2